package com.sun.mybatisplus.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sun.mybatisplus.bean.UserExt;
import com.sun.mybatisplus.mapper.UserExtMapper;
import com.sun.mybatisplus.service.UserExtService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class UserExtImpl extends ServiceImpl<UserExtMapper, UserExt> implements UserExtService {

    @Override
    public void addData(UserExt userExt) {
        if (userExt.getAddr().equals("深圳")){
            throw new RuntimeException("userExt主动抛出的异常");
        }
        if (!this.save(userExt)) {
            throw new RuntimeException("userExt插入失败");
        }
    }
}
